# encoding=utf-8
####计划任务模块
from apscheduler.scheduler import Scheduler
print '中国'

# 执行定时任务 在某个时刻执行该任务

import time, os, sys, sched

schedule = sched.scheduler(time.time, time.sleep)

def perform_command(cmd, inc):
    # enter 延迟时间 优先级 回调函数 参数
    os.system(cmd)
    print ''
    print time.time()
    schedule.enter(inc, 0, perform_command, (cmd, inc))


def CirculeGo(cmd, inc=60):
    schedule.enter(0, 0, perform_command, (cmd, inc))
    schedule.run()


sched = Scheduler()
sched.daemonic = False

@sched.cron_schedule(day_of_week='0-4', hour='7,9')
def job_function():
    os.system('python D:\PythonSource\get_market_value\get_market_value\main.py')


# 在某个时刻执行该任务
#job1 = sched.add_date_job(perform_command, datetime(year, month, day, 8, 00, 00), ['python D:\PythonSource\get_market_value\get_market_value\main.py', 1])


try:
    sched.start()
except (KeyboardInterrupt, SystemExit):
    sched.shutdown()
